package avicit.bdp.dgs.qa.utils.enums;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2023-07-04
 * @类说明：ArgumentType
 * @修改记录：
 * @注意事项：
 * @主要功能：模板参数类型
 */
public enum ArgumentType {
    COMMON(0, "Common"),
    INPUT(1, "Input"),
    SELECT(2, "Select"),
    INPUT_NUM(3, "InputNumber"),
    DATE_PICKER(4, "DatePicker");

    private final int code;

    private final String desc;

    ArgumentType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(Integer code) {
        if (code != null) {
            ArgumentType[] values = ArgumentType.values();
            for (ArgumentType resourceType : values) {
                if (resourceType.getCode() == code) {
                    return resourceType.getDesc();
                }
            }
        }

        return null;
    }

    public static ArgumentType getTypeByCode(Integer code) {
        if (code != null) {
            ArgumentType[] values = ArgumentType.values();
            for (ArgumentType resourceType : values) {
                if (resourceType.getCode() == code) {
                    return resourceType;
                }
            }
        }

        return null;
    }
}
